<!DOCTYPE html>
<html>
<head>
<base href="../">
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="js/layer/layer.js"></script>
<script type="text/javascript" src="js/template.js"></script>
<script type="text/javascript" src="js/base.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="css/base.css" >
</head>
<body>
<script type="text/html" id="template1">
	<% for(var i=0;i<data.length;i++){ 
		var item=data[i];
	%>
		<div class="item" onclick="details(this,<%=item.id%>)"><b><%=item.name%></b><span><%=item.price%></span></div>
    <%}%>
</script>
 <select  class="form-control search" name="search"></select>
 
 <button onclick="search();">查询</button>
 <div class="items">  
 
 
 </div>
 

<script type="text/javascript">

function details(target,id){
	var name=$(target).find("b").text();
	openLayer("Order_Main/step_details_up.html?id="+id,"("+name+")明细");
}


function load(params){
	ajax_get("Order_Main/fooddetails",params,function(json){
		setList($("[name=search]"),"FoodType/getlist",json.status);
		var myTemplate =  document.getElementById('template1').innerHTML; 
		  var myHtml = miniTpl(myTemplate, json.data);
		$(".items").empty();
		$(".items").append($(myHtml));
	})
}
function search(){
	var txt=$("[name=search]").val();
	load({search:txt,status:1})
}

$(function(){
	
	load({status:1})
	
	
	
})
</script>

</body>
</html>